<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="app"></div>
    <!--  当dom加载完毕后 来一句渲染完成 -->
    <script>
        console.log(1);
        let channel = new MessageChannel();
        let port1 = channel.port1;
        let port2 = channel.port2;
        port1.onmessage = function(e){
            console.log(e.data);
        }
        console.log(2);
        port2.postMessage(100);
        console.log(3)

        //  console.log(1)
        // let observe = new MutationObserver(function(){
        //     console.log('渲染完成')
        // });
        // observe.observe(app,{ childList:true  })
        // for(var i = 0;i<100;i++){
        //     let p = document.createElement('p');
        //     app.appendChild(p);
        // }
        // for(var i = 0;i<100;i++){
        //     let p = document.createElement('p');
        //     app.appendChild(p);
        // }
        // console.log(2)
    </script>
</body>
</html>